Editing Random Encounters in Fallout 2
This tutorial intends to familiarise the reader with the basics of editing World Map Random Encounters in Fallout 2. It assumes the reader has at least a basic understanding of how Fallout works and how it is organised. Written by Ardent. Getting started All of Random Encounter editing takes place in two files: worldmap.txt, found in data/data, and worldmap.msg found in data/text/english/game. NOTE! If you are using a different language version of Fallout, the name of the folder "english" may change accordingly. Both files can be easily edited with any text editor (such as Notepad, Wordpad, etc.). Contents of worldmap.txt *'Random Encounter frequency' - Beginning at line 31, there is the frequency of Random Encounters (thereinafter: Random Encounters, Encounters, REs). Fallout 2 is using several macros for the frequency, namely: None, Rare, Uncommon, Common, Frequent, Forced. It looks as though you could edit the percentages for each macro (though you shouldn't change the values of None and Forced REs, which are set to 0% and 100% respectively), but I have never tested it personally and cannot be sure. *'Terrain types' - We find here some debugging information and some more or less mysterious commands. This section is of little interest to us at the moment. *'Maps used for REs' - This is the list of maps used to place objects on in the random encounters. Each of four types of terrain has its own list. The maps are listed by their lookup name (stated in maps.txt, in data/data). Fallout 2 lists at most 12 maps for each terrain type. It is unknown whether one can add more. *'Random Encounter types' - Here one can edit each type of random encounter, determining critters and objects, as well as assigning scripts that appear on it. *'Random Encounter tables' - This section establishes "sets" of Random Encounters. Each World Map tile can have one such set assigned. *'World Map Tile information' - This section is responsible for determining Random Encounters that occur on every tile of the World Map. Expected limitations of World Map editing *You can only place up to 50 Encounters in an encounter table - the encounter descriptions start every 50 lines. *You can only place up to 100 objects in a given Encounter - the pointer names have only two digits (00 to 99). *Each World Map Master Tile has 42 Small Tiles. You cannot exceed this number. You can however put more Master Tiles than 20. No upper limit is known. Editing Random Encounter Types Each type of random encounter has several descriptors which serve to determine what the Encounter is about. Have a look at the example below: ARRO_Hunting_Party type_00=pid:16777418, Item:280(wielded), Item:(0-10)41, Script:484 ; Male Hunter w/ Sharp Spear (Leader) type_01=ratio:60%, pid:16777418, Item:7(wielded), Item:(0-10)41, Script:484 ; Male Hunter w/ Spear type_02=ratio:40%, pid:16777419, Item:7(wielded), Item:(0-10)41, Script:484 ; Female Hunter w/ Spear type_03=Dead, pid:16777296, Distance:7 ; Dead Silver Gecko position=wedge, spacing:2 *'Name:' each RE type has its unique name to distinguish it in the RE tables. The name should be written in square brackets, with the phrase "Encounter: " preceding the name: ARRO_Hunting_Party *'Type:' type of object that appears in the encounter. Each type needs to possess a distinct number, starting from 00, up to 99 (this means that in theory you can place as many as 100 different objects on the map). There can be no gaps. Moreover, each type can be described with several properties, such as the PID number, items which the object is holding, the number of attached script, the distance from the player, etc. The full list will be provided further on. *'Position:' how far the critters are from the player critter, their formation and distance from one another. Properties for object types The fragment of worldmap.txt below presents all properties assignable to objects in a random encounter: ; Type Subinfo: ;------------- ; Ratio:#% determines frequency of occurrence ; pid:<#> determines what this critter's pid is ; pid: looks up the pid # from the string ; Script:<#> overrides the default script with a new one ; Dead means that the critter starts out in a dead state ; Item:<#> gives an item of a given pid # ; Item: dictates an item (from a lookup table) that this critter has ; Item:(#) the # dictates quantity of the item, possibly a range ; Item:() -- give a whole *list* of items ; If: -- conditionals, allows <,>,<=,>=, ,& as well as tests ; on Player(), Enctr(Num_Critters), ; Time, Global(), Rand(Chance%) ; Distance:# -- Forces the distance for a particular critter (if possible) ; (TileNum) -- Forces this object to appear at the same tile # as ; the object listed at (this means the last one if there were ; multiples of that type). ; TileNum:# -- Forces this object to appear at a given tile # ; Spatial: -- attaches a spatial script to the map The list above is mostly self-explanatory, but we may attempt to clarify it for the reader: *'Ratio:' This is different from the frequency of the random encounter. It determines the frequency of appearance of this particular object. For example, one may want to declare seven types of raiders to appear in the encounter, but some of them will only appear 15% of the time. *'pid:' This is the PID number from the appropraite header file. *'pid (string):' One can establish macros within the worldmap.txt file, to avoid looking up pid numbers. This doesn't seem to be working anymore. *'Script:' The number of the script that will be attached to the object. *'Dead:' This tag means that the critter will be killed upon entering the map. *'Item:' There are various item commands, where you can either put the PID number, or a name from a lookup list, but it seems as though lookup lists are not used at all in the file. Most RE types use the PID number, optionally with a range determining the number of instances of the item and a special tag which puts the item in the object's hands: type_01=ratio:25%, pid:16777282, Item:299(Wielded), Item:(1-2)71, Item:(0-10)41, Item:40, Script:493 ; Average Peasant Female w/ Pipe Rifle and a Stimpak In this example, we can see that the object has a Pipe rifle, which she is wielding (PID number: 299). She also has a random amount (from 0 to 10) of caps, and a stimpak (PID #40). *'Conditionals:' This is used for the encounter as a whole and not in connection to any particular object. We shall discuss that in the Editing RE tables section. *'Distance:' This command forces a particular distance from the player. *'TileNum:' This command forces the object to appear on the particular tile number. *'(TileNum):' This command forces the described object to appear on the same tile as a different object. Type_00 and subsequent Types serve as pointers to these objects. (See example below) *'Spatial:' See example below. ;;type_04=Spatial:tripwire, TileNum:type_03{TileNum} ; Body is trapped ;;type_05=pid:Mutated Fruit, TileNum:Player{TileNum} ; Also, you found a mutated fruit (at your feet) Since these are commented out and don't appear later in the file, there may be some problems with these commands. It remains to be tested. Formations available in Random Encounters There is no visible list in the file, but on an initial look, we may list several formations available for objects in random encounters: *straight_line *double_line *huddle *cone *wedge *Surrounding Editing Random Encounter Tables Random Encounter tables are strictly connected with worldmap.msg file. See the appropraite section for details. Similarly to RE types, the RE tables come with a set of properties. Let's look at the example: Table 6 lookup_name=Arro_M ; Areas around Arroyo to nearly the ocean maps=Mountain Encounter 1, Mountain Encounter 2, Mountain Encounter 4, Mountain Encounter 5 ; No Caverns here enc_00=Chance:9%,Enc:(2-4) ARRO_War_Party AMBUSH Player enc_01=Chance:9%,Enc:(2-4) ARRO_Cannibals AMBUSH Player enc_02=Chance:9%,Enc:(2-4) ARRO_Spore_Plants AND (1-2) ARRO_Silver_Geckos FIGHTING Player enc_03=Chance:12%,Enc:(1-4) ARRO_Silver_Geckos AMBUSH Player enc_04=Chance:15%,Enc:(2-5) Bounty_Hunter_Low AMBUSH Player, If(Global(1) > 1) And If(Player(Level) < 7) enc_05=Chance:15%,Enc:(2-5) Bounty_Hunter_Low_Mid AMBUSH Player, If(Global(1) > 1) And If(Player(Level) > 6) And If(Player(Level) < 13) enc_06=Chance:15%,Enc:(2-5) Bounty_Hunter_High_Mid AMBUSH Player, If(Global(1) > 1) And If(Player(Level) > 12) And If(Player(Level) < 19) enc_07=Chance:15%,Enc:(2-6) Bounty_Hunter_High AMBUSH Player, If(Global(1) > 1) And If(Player(Level) > 18) enc_08=Chance:15%,Enc:(2-4) Bounty_Hunter_Low AMBUSH Player, If(Global(0) < -500) And If(Player(Level) < 7) enc_09=Chance:15%,Enc:(2-4) Bounty_Hunter_Low_Mid AMBUSH Player, If(Global(0) < -500) And If(Player(Level) > 6) And If(Player(Level) < 13) enc_10=Chance:15%,Enc:(2-4) Bounty_Hunter_High_Mid AMBUSH Player, If(Global(0) < -500) And If(Player(Level) > 12) And If(Player(Level) < 19) enc_11=Chance:15%,Enc:(2-5) Bounty_Hunter_High AMBUSH Player, If(Global(0) < -500) And If(Player(Level) > 18) enc_12=Chance:10%,Enc:(4-7) Morton_Brother, If(Global(386) > 0) And If(Global(386) < 6) enc_13=Chance:12%,Enc:(3-6) ARRO_Sm_Scorpions AMBUSH Player enc_14=Chance:12%,Enc:(3-6) ARRO_Spore_Plants AMBUSH Player enc_15=Chance:12%,Enc:(4-8) ARRO_Pig_Rats AMBUSH Player enc_16=Chance:12%,Enc:(6-10) ARRO_Rats AMBUSH Player enc_17=Chance:2%,Enc:(2-4) ARRO_Hunting_Party FIGHTING (3-4) ARRO_Cannibals enc_18=chance:3%,Enc:(6-9) ARRO_Ants AMBUSH Player enc_19=Chance:2%,Enc:(2-4) ARRO_Hunting_Party FIGHTING (3-6) ARRO_Sm_Scorpions enc_20=Chance:3%,Enc:(2-4) ARRO_Pig_Rats AMBUSH Player enc_21=Chance:4%,Enc:(2-4) ARRO_Sm_Scorpions AMBUSH Player enc_22=Chance:4%,Enc:(5-8) ARRO_Ants enc_23=Chance:5%,Enc:(3-6) ARRO_Hunting_Party enc_24=Chance:5%,Enc:(3-5) ARRO_Nomads enc_25=Chance:1%,Counter:1,Special,Map:Special Bridge Encounter,Enc:Special1, If(Player(Level) > 9) And If(Global(605) < 1) enc_26=Chance:1%,Counter:1,Special,Map:Special Holy Encounter 2,Enc:Special1, If(Global(372) > 0) And If(Global(606) < 1) *'Name:' Each RE table has its name which is just a subsequent number. There can be no gaps. The name is put in square brackets. *'Maps:' Maps used for this set of random encounters. The list uses map lookup names from maps.txt. *Each encounter has its own number, very similar to how it was handled with encounter types. The numbers start at 00 and should finish at 99. *'Chance:' The probability for this encounter to occur. As you can see, you should not be concerned with all percentages adding up to a 100%. *'Enc:' This range lists the number of critters/objects to appear in the encounter. For example, enc_16 is 6 to 10 rats. *'AMBUSH' command. I'm not sure what this means, but it has probably to do with Outdoorsman checks whether the Player wishes to encounter these critters, or maybe it has to do with initial distance. In either case, the command seems quite straightforward to use. *There is also another command, similar to AMBUSH. It is the FIGHTING command, and looks pretty obvious: It forces a fight between two different types of Random Encounters: enc_21=Chance:2%,Enc:(3-5) KLA_Trappers FIGHTING (2-3) KLA_Golden_Geckos *'Name of the encounter:' Here the lookup name of the encounter should be copied. rConditionals in REs One can set conditions of occurence for random encounters. Let us look at the notes made by the developers of Fallout 2: ; If: -- conditionals, allows <,>,<=,>=, ,& as well as tests ; on Player(), Enctr(Num_Critters), ; Time, Global(), Rand(Chance%) In the above RE table example, there were several conditions. Bounty hunters would ambush the Player if global_var number 0 (General Reputation) were lower than -500, AND when the Player's Experience level were this and this. Follow the example for correct syntax. Note: In my experience these conditionals (at least) do *not* work in encounter tables and you will get the encounter regardless. <=,>= Tested with: If(Player(Level) <= 4) Special Encounters Special Encounters are a little bit different from the regular ones. The first command is the "Special" command, which will force the engine to display a circled lightning bolt icon when the encounter happens, and not the regular lightning bolt icon. There is also the "Counter" command, which determines how many times this encounter can happen (this command can be successfully used with regular encounters as well). Also, there is condition of global variable number 605 being less than 1. 605 is GVAR_SPECIAL_ENCOUNTER_BRIDGE, so it looks as it overlaps with the "Counter" command (or maybe it's checked elsewhere in game). There is also the possibility to force a particular map, which works also with regular random encounters. Editing World Map Tile information We're moving on to the last part of editing worldmap.txt. This section describes how to edit information on encounters on every tile of the World Map. The world map is divided into several large tiles, which we shall call Master Tiles (MTs). Each MT is composed of 42 small Tiles (hereinafter Tiles, Small Tiles, or STs). On the standard Fallout 2 world map there are 20 MTs, which amounts to 840 STs. First of all, one must determine the amount of horizontal tiles that are in the World Map, for the game to place them in correct order. The MTs are put from left to right. Once the program reaches the maximum value of horizontal tiles, it places another layer beneath the first one, also from left to right. ; All of the Tile information: Data num_horizontal_tiles=4 Once this value has been set, let us look at an example Master Tile: 17 art_idx=356 encounter_difficulty=-5 walk_mask_name=wrldmp17 ; x_offset_yoffset=terrain,morning_chance,afternoon_chance,night_chance,type 0_0=Ocean,No_Fill,Uncommon,Uncommon,Uncommon,Fran_O 0_1=Ocean,No_Fill,None,None,None,Fran_O 0_2=Ocean,No_Fill,None,None,None,Fran_O 0_3=Ocean,No_Fill,None,None,None,Fran_O 0_4=Ocean,No_Fill,None,None,None,Fran_O 0_5=Ocean,No_Fill,None,None,None,Fran_O 1_0=Ocean,No_Fill,Uncommon,Uncommon,Uncommon,Fran_O 1_1=Ocean,No_Fill,Rare,Rare,Rare,Fran_O 1_2=Ocean,No_Fill,Rare,Rare,Rare,Fran_O 1_3=Ocean,No_Fill,Rare,Rare,Rare,Fran_O 1_4=Ocean,No_Fill,Rare,Rare,Rare,Fran_O 1_5=Ocean,No_Fill,None,None,None,Fran_O 2_0=Ocean,No_Fill,Uncommon,Uncommon,Uncommon,Fran_O 2_1=Ocean,No_Fill,Rare,Rare,Rare,Fran_O 2_2=City,No_Fill,Frequent,Frequent,Frequent,Fran_C 2_3=City,No_Fill,Uncommon,Uncommon,Uncommon,Fran2_C 2_4=Ocean,No_Fill,Rare,Rare,Rare,Fran_O 2_5=Ocean,No_Fill,Rare,Rare,Rare,Fran_O 3_0=Mountain,No_Fill,Uncommon,Uncommon,Uncommon,Fran_M 3_1=City,No_Fill,Common,Common,Common,Fran_C 3_2=City,No_Fill,Common,Common,Common,Fran_C 3_3=City,No_Fill,Uncommon,Uncommon,Uncommon,Fran_C 3_4=City,No_Fill,Uncommon,Uncommon,Uncommon,Fran2_C 3_5=Ocean,No_Fill,Rare,Rare,Rare,Fran_O 4_0=Mountain,No_Fill,Uncommon,Uncommon,Uncommon,Fran_M 4_1=City,No_Fill,Uncommon,Uncommon,Uncommon,Fran2_C 4_2=City,No_Fill,Uncommon,Uncommon,Uncommon,Fran2_C 4_3=City,No_Fill,Uncommon,Uncommon,Uncommon,Fran2_C 4_4=City,No_Fill,Uncommon,Uncommon,Uncommon,Fran2_C 4_5=Ocean,No_Fill,Rare,Rare,Rare,Fran_O 5_0=Desert,No_Fill,Uncommon,Uncommon,Uncommon,Fran2_D 5_1=Mountain,No_Fill,Uncommon,Uncommon,Uncommon,Fran_M 5_2=Mountain,No_Fill,Uncommon,Uncommon,Uncommon,Fran_M 5_3=Mountain,No_Fill,Uncommon,Uncommon,Uncommon,Fran_M 5_4=Desert,No_Fill,Uncommon,Uncommon,Uncommon,Fran_D 5_5=City,No_Fill,Uncommon,Uncommon,Uncommon,Fran_C 6_0=Desert,No_Fill,Common,Common,Common,Wild5_D 6_1=Desert,No_Fill,Uncommon,Uncommon,Uncommon,Wild5_D 6_2=Mountain,No_Fill,Rare,Rare,Rare,Wild5_M 6_3=Mountain,No_Fill,Rare,Rare,Rare,Wild5_M 6_4=Mountain,No_Fill,Rare,Rare,Rare,Wild5_M 6_5=Desert,No_Fill,Rare,Rare,Rare,Wild5_D *'Name:' Each tile has its number, which serves as a name. The name is put in square brackets. *'art_idx:' This is the number of the file in INTRFACE.lst, found in data/art/intrface. *'encounter_difficulty:' Pop-up option that lets you choose if you want an encounter or not. Basically a normal Outdoorsman skill check if left at 0. A positive value makes it easier and a negative makes it harder. Intuitively, you may attribute smaller/negative values to maps from the beginning of the game, and bigger (negative) numbers in the locations nearer to the end. *'walk_mask_name: '''This line appears only on the tiles which contain water, or other inaccessible areas. It defines the name of the .msk file which goes with this tile. msk files are stored in data\data. The remaining part is the description of each ST being a part of the MT. The authors provided us with a little helper line: ; x_offset_yoffset=terrain,morning_chance,afternoon_chance,night_chance,type '''What is it about:' *'x_offset, y_offset:' where the Small Tile is placed on the large tile. If offset is set to 0_0, then it is the upper-left-corner-most Small Tile of the given Master Tile. *'terrain:' which type of terrain is used for this Small Tile. This is important because of movement speed modifiers. However, it has nothing to do with the maps chosen for the random encounters (this is set in the Encounter Table). *'No_Fill:' There are two possibilities for this line. Fill_W means that the map will be revealed to the west, when the Player steps on this ST. This is used to reveal the ocean. No_Fill reveals only the tile on which the player is at the moment. Other logical options, like Fill_N, Fill_S, or Fill_E, do not work (tested by Lexx). *'Encounter chances:' These are using macros established at the very beginning of the file. One can alter the frequency of encounters in the morning, during the day, or at night. *'Encounter table:' Here one can set the encounter table relevant for this particular Small Tile. Editing worldmap.msg Worldmap.msg is a text file containing names for the different random encounters. We are only concerned with the second part of the file (the first one contains area names for town maps). It begins with the following: # # Worldmap Encounter messages # {2998}{}{You encounter:} {2999}{}{Do you wish to encounter:} What follows, are the descriptions for each encounter table. Let us look at an example: # Encounter Table 6 {3300}{}{A war party.} {3301}{}{A group of cannibals.} {3302}{}{A group of spore plants and some silver geckos.} {3303}{}{A group of silver geckos.} {3304}{}{Some bounty hunters.} {3305}{}{Some bounty hunters.} {3306}{}{Some bounty hunters.} {3307}{}{Some bounty hunters.} {3308}{}{Some bounty hunters.} {3309}{}{Some bounty hunters.} {3310}{}{Some bounty hunters.} {3311}{}{Some bounty hunters.} {3312}{}{A band of ruffians led by a Morton Brother.} {3313}{}{A group of scorpions.} {3314}{}{A group of spore plants.} {3315}{}{A group of pig rats.} {3316}{}{A group of rats.} {3317}{}{A hunting party fighting cannibals.} {3318}{}{A group of ants.} {3319}{}{A hunting party fighting some scorpions.} {3320}{}{A small group of pig rats.} {3321}{}{A small group of radscorpions.} {3322}{}{A small group of ants.} {3323}{}{A hunting party.} {3324}{}{A group of nomads.} {3325}{}{A man guarding a bridge.} {3326}{}{King Arthur's Knights fighting a rat.} The first line is only a comment. Then, for each enc_$$, that we find in the relevant encounter table, there is the description. If you fail to provide a description for a given encounter, the game will display "Error" instead of the message. Category:Fallout_2_tutorials